# -*- coding: utf-8 -*-
# @Time    : 2018/11/30 9:16
# @Author  : zjj
# @Email   : 1933860854@qq.com
# @File    : util.py
# @Software: PyCharm
import random
def keywordUtil():
    path = 'E:\\pycharmProject\\iQiYiSpider\\iQiYiSpider\\keyword.txt'
    s = set()
    list = ['搬家']
    with open(path, 'r', encoding='UTF-8') as file:
        for line1 in file.readlines(): # 一次读整个文件，速度较快
            # for lines in file.readline(): # 一次读一行，速度较慢
            line1 = line1.strip() # 删除空白符（包括'\n', '\r',  '\t',  ' ')
            if line1 != '':
                s.add(line1)
    if len(s) > 0:
        for str in s:
            list.append(str)
    return list

def cityUtil():
    path = 'E:\\pycharmProject\\iQiYiSpider\\iQiYiSpider\\city.txt'
    s = set()
    list = ['广州']
    with open(path, 'r', encoding='UTF-8') as file:
        for line1 in file.readlines(): # 一次读整个文件，速度较快
            # for lines in file.readline(): # 一次读一行，速度较慢
            line1 = line1.strip() # 删除空白符（包括'\n', '\r',  '\t',  ' ')
            if line1 != '':
                s.add(line1)
    if len(s) > 0:
        for str in s:
            list.append(str)
    return list

def domainUtil():
    path = 'E:\\pycharmProject\\iQiYiSpider\\iQiYiSpider\\domain.txt'
    s = set()
    list = ['58.com']
    with open(path, 'r', encoding='UTF-8') as file:
        for line1 in file.readlines(): # 一次读整个文件，速度较快
            # for lines in file.readline(): # 一次读一行，速度较慢
            line1 = line1.strip() # 删除空白符（包括'\n', '\r',  '\t',  ' ')
            if line1 != '':
                s.add(line1)
    if len(s) > 0:
        for str in s:
            list.append(str)
    return list

def companyUtil():
    path = 'E:\\pycharmProject\\iQiYiSpider\\iQiYiSpider\\company.txt'
    s = set()
    list = ['感激']
    with open(path, 'r', encoding='UTF-8') as file:
        for line1 in file.readlines(): # 一次读整个文件，速度较快
            # for lines in file.readline(): # 一次读一行，速度较慢
            line1 = line1.strip() # 删除空白符（包括'\n', '\r',  '\t',  ' ')
            if line1 != '':
                s.add(line1)
    if len(s) > 0:
        for str in s:
            list.append(str)
    return list
if __name__ == '__main__':
    print(cityUtil())
    # print('http:///hahaha'.replace('///', '//'))